package com.redepronik.negosys.rrhh.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;

/**
 * The persistent class for the telefonopersona database table.
 * 
 */
@Entity
@Table(schema = "rrhh", name = "telefonopersona")
@NamedQuery(name = "Telefonopersona.findAll", query = "SELECT t FROM Telefonopersona t")
public class Telefonopersona implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(allocationSize = 1, name = "TELEFONOPERSONA_TELEFONOPERSONAID_GENERATOR", sequenceName = "RRHH.TELEFONOPERSONA_TELEFONOPERSONAID_SEQ")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TELEFONOPERSONA_TELEFONOPERSONAID_GENERATOR")
	@Column(unique = true, nullable = false)
	private Integer telefonopersonaid;

	@Length(max = 200, message = "EL CAMPO REFERENCIA ACEPTA HASTA 200 CARACTERES")
	@Column(length = 200)
	private String referencia;

	@Pattern(regexp = "^[0-9]{7,10}", message = "INGRESE UN TELÉFONO VALIDO")
	@Column(nullable = false, length = 25)
	private String telefono;

	@Column(nullable = false)
	private Integer orden;

	// bi-directional many-to-one association to Persona
	@ManyToOne
	@JoinColumn(name = "personaid", nullable = false)
	private Persona persona;

	public Telefonopersona() {
	}

	public Integer getOrden() {
		return orden;
	}

	public Persona getPersona() {
		return this.persona;
	}

	public String getReferencia() {
		return this.referencia;
	}

	public String getTelefono() {
		return this.telefono;
	}

	public Integer getTelefonopersonaid() {
		return this.telefonopersonaid;
	}

	public void setOrden(Integer orden) {
		this.orden = orden;
	}

	public void setPersona(Persona persona) {
		this.persona = persona;
	}

	public void setReferencia(String referencia) {
		this.referencia = referencia;
	}

	public void setTelefono(String telefono) {
		this.telefono = telefono;
	}

	public void setTelefonopersonaid(Integer telefonopersonaid) {
		this.telefonopersonaid = telefonopersonaid;
	}

}